// ex7_13_8.cpp -- c7:7.15:arrobj.cpp -- functions with array objects(C++11)
#include <iostream>
#include <string>
#include <cstring>

const int Seasons = 4;
const char seasons[Seasons][12] = {"Spring", "Summer", "Fall", "Winter"};
//enum seasons = {Spring, Summer, Fall, Winter};

// function to modify 
void fill(char arr[][12]);
// function that without modifying it
void show(char arr[][12]);
int main(void)
{
	using std::cout;
	char arr[4][12] = {0};
	/*for (int i = 0; i < 4; i++)
	{
		cout << seasons[i] << endl;
	}*/

	fill(arr);
	cout << "show function():\n";
	show(arr);
	return 0;
}

// function to modify 
void fill(char arr[][12])
{
	//char (*ptr)[4] = arr;
	using std::cout;
	for (int i = 0; i < Seasons; i++)
	{
		//strcpy(arr[i],seasons[i]); 
		strncpy(arr[i], seasons[i], sizeof(seasons[i]));
	}
}
// function that without modifying it
void show(char arr[][12])
{
	using std::cout;
	for (int i = 0; i < Seasons; i++)
	{
		cout << arr[i] << expense[i] << "\n";
	}
}
